import { action, computed, observable } from 'mobx';
import { Md5 } from 'xo-web-base';

/**
 * Home模块跨组件共享Store
 * Store需按模块划分
 */
export default class HomeStore {
  @observable
  number = 1;

  @computed
  get sub10() {
    return this.number - 10;
  }

  @computed
  get md5() {
    return Md5.encode(this.number.toString());
  }

  @action
  increment() {
    this.number++;
  }

  @action
  decrement() {
    this.number--;
  }
}

export const homeStore = new HomeStore();
